'''
考勤组页面管理
'''
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage


class AttendanceGroup(KeyWords):
    # 新增商户页面
    url = KeyWords.url + 'attendancesManagement/attendancesGroup'

    # 新增考勤组
    def add_attendance_group(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\attendance\attendance_group\add_group.yaml')
        element_operation(self, data[0]['data'])

    # 查看考勤组详情
    def attendance_group_detail_and_update(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\attendance\attendance_group\group_detail_update.yaml')
        element_operation(self, data[0]['data'])

    # 考勤组终止和开启
    def attendance_group_stop_and_open(self):
        data = get_data_by_yaml(get_path() + r'\Data\element_data\attendance\attendance_group\group_stop_and_open.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobeAdmin002', 'kobe8888')
        case = AttendanceGroup(driver)
        case.attendance_group_stop_and_open()
        driver.quit()
    except Exception as e:
        driver.quit()
